package demo5;

@SuppressWarnings({"all"})
public class Class {
    public static void main(String[] args) throws ClassNotFoundException {
        person person1 = new student();
        System.out.println("这个人就是"+person1.name);
        java.lang.Class c1 = person1.getClass();
        System.out.println(c1.hashCode());

        java.lang.Class c2 = java.lang.Class.forName("demo5.student");
        System.out.println(c2.hashCode());

        java.lang.Class c3 = student.class;
        System.out.println(c3.hashCode());

    }
}

class person{
    String name;

    public person() {
    }
    public person(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "person{" +
                "name='" + name + '\'' +
                '}';
    }
}
@SuppressWarnings({"all"})
class student extends person{
    public student() {
        this.name="学生";
    }
}


class teacher extends person{
    public teacher(){
        this.name="老师";
    }
}